import Axios, { downLoadFile } from '@/utils/request';
import {
    EntryRecordDTO,
    EntryRecordRepVO,
    SourceTreeVO,
    cardSearchDTO,
    cardSearchReqVO,
    clauseManageDTO,
    clauseManageReqVO,
    sourceManageDTO,
    sourceManageReqVO,
} from '../vo/index';

export default class API {
    /**
     * 合规卡列表
     */
    static cardList(data: cardSearchReqVO): Promise<cardSearchDTO> {
        return Axios.post('todo/card/list', data);
    }
    /**
     * 复制合规卡
     */
    static copyCard(data: any): Promise<any> {
        return Axios.post('todo/card/copy', data);
    }

    /**
     * 获取来源层次树
     * @data 制度/合同
     */
    static getSourceTree(data: any): Promise<SourceTreeVO[]> {
        return Axios.post('/indexArticle/treed', data);
    }

    /**
     * 导出
     * @param data
     */
    static downLoadFileCard(data: any) {
        downLoadFile({
            url: '/card/export',
            method: 'post',
            data: data,
        });
    }

    /**
     * 导入模板下载
     * @param {}
     */
    static downLoadFileImportTem() {
        downLoadFile({
            url: 'card/downLoadFile',
            method: 'post',
            data: {},
        });
    }

    /**
     * 导入失败明细下载
     * @param {}
     */
    static downLoadFileImportTemError() {
        downLoadFile({
            url: 'card/downLoadFileError',
            method: 'post',
            data: {},
        });
    }

    /**
     * 待办处置 type:cancel|confirm|update  取消待办|修改待办提示内容|确认
     */
    static dealConfig(data: any): Promise<any> {
        return Axios.post('todo/card/deal', data);
    }

    /**
     * 删除单行合规卡
     */
    static deleteCard(data: { cardCode: string }): Promise<any> {
        return Axios.post('todo/card/delete', data);
    }

    /**
     * 获取预设置条目待办提醒
     */
    static getTodoList(): Promise<any> {
        return Axios.post('todo/todo', {});
    }

    /**
     * 获取合规情况总览
     */
    static getComplianceOverview(data): Promise<any> {
        return Axios.post('todo/todo2', data);
    }

    /**
     * 获取赢和条目变更记录
     * @source TL_HS_ENTRY_CONTROL
     */
    static getYhEntryRecord(data: EntryRecordDTO): Promise<EntryRecordRepVO> {
        return Axios.post('todo/TL_HS_ENTRY_CONTROL', data);
    }
    /*******  合规来源管理 START */
    /**
     * 来源管理列表
     * @param data
     * @returns
     */
    static sourceManageList(data: sourceManageReqVO): Promise<sourceManageDTO> {
        return Axios.post('todo/source/list', data);
    }

    /**
     * 来源编辑
     * @param data
     * @returns
     */
    static editSourceManage(data: any): Promise<any> {
        return Axios.post('todo/source/copy', data);
    }

    /**
     * 导出来源管理
     * @param data
     */
    static downLoadFileSourceManage(data: any) {
        downLoadFile({
            url: '/source/export',
            method: 'post',
            data: data,
        });
    }

    /**
     * 来源管理行操作记录
     * @param data
     */
    static SourceUpdateRecordList(data: any) {
        return Axios.post('todo/source/record', data);
    }

    /**
     * 条款管理列表
     * @param data
     * @returns
     */
    static clauseManageList(data: clauseManageReqVO): Promise<clauseManageDTO> {
        return Axios.post('todo/clause/list', data);
    }

    /**
     * 条款编辑
     * @param data
     * @returns
     */
    static editClauseManage(data: any): Promise<any> {
        return Axios.post('todo/clause/copy', data);
    }

    /**
     * 导出条款
     * @param data
     */
    static downLoadFileClauseManage(data: any) {
        downLoadFile({
            url: '/clause/export',
            method: 'post',
            data: data,
        });
    }

    /**
     * 条款管理删除条款
     */
    static deleteClause(data: { termCode_: string[] }): Promise<any> {
        return Axios.post('todo/card/delete', data);
    }

    /*******  合规来源管理 END */
}
